package thread;

class MyThread1 extends Thread {
    public void run() {
        System.out.println("线程开始执行");
        for (int i = 0; i < 5; i++) {
            System.out.println("计数：" + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("线程执行结束");
    }
}

/*class SingLetonLazy{
    private static volatile SingLetonLazy insatance=null;
    private static Object loker=new Object();
    public static SingLetonLazy getInstance(){
        if (insatance==null){
            synchronized (loker){
                if(insatance==null){
                    insatance=new SingLetonLazy();
                }
            }
        }
        return insatance;
    }

    SingLetonLazy(){

    }

}*/
public class Text {
/*    public static void main(String[] args) {
        SingLetonLazy singLetonLazy1=SingLetonLazy.getInstance();
        SingLetonLazy singLetonLazy=SingLetonLazy.getInstance();
        System.out.println(singLetonLazy1==singLetonLazy);
    }*/
    public static void main1(String[] args) {
        MyThread1 thread1 = new MyThread1();
        thread1.start();
        MyThread1 thread2 = new MyThread1();
        thread2.start();
    }
}
